import React from 'react'
import { useLocation } from 'react-router-dom'

export default function Newdetail () {
  const location = useLocation()
  console.log(location)
  // 在react中使用URLSearchParams获取url参数
  const searchParams = new URLSearchParams(location.search)
  return (
    <div>
      Newdetail-{searchParams.get('id')} {searchParams.get('name')}
    </div>
  )
}
